package com.zqh.myfmmall.fallback;

import com.zqh.myfmmall.clients.ProductCommentQueryClient;
import com.zqh.myfmmall.result.Result;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-03-16 22:25
 */
@Slf4j
public class ProductCommentQueryClientFallback implements FallbackFactory<ProductCommentQueryClient>{
    @Override
    public ProductCommentQueryClient create(Throwable cause) {
        log.warn("exception in calling productcommentquery service"+cause);
        return new ProductCommentQueryClient(){
            @Override
            public Result page(Integer pageNum, Integer pageSize, String productId) {
                return Result.internalServerError();
            }

            @Override
            public Result retrieveCommentsCount(String productId) {
                return Result.internalServerError();
            }
        };
    }
}
